<?php
/**
 * jishupu-cms
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2021/11/11
 */

namespace App\Http\Resources;

/**
 * 留言咨询模块资源
 * Class GuestbookResource
 * @package App\Http\Resources
 */
class GuestbookResource extends BaseResource
{
    /**
     * @param \Illuminate\Http\Request $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return $this->filterFields([
            'id' => $this->id,
            'customer_name' => $this->customer_name,
            'customer_phone_number' => $this->customer_phone_number,
            'customer_email' => $this->customer_email,
            'message' => $this->message,
            'remark' => $this->remark,
            'status' => $this->status,
            'created_at' => $this->created_at ? $this->created_at->format('Y-m-d H:i:s') : "",
            'updated_at' => $this->updated_at ? $this->updated_at->format('Y-m-d H:i:s') : ""
        ]);
    }
}
